const http = require("http");
const { URL } = require('url');
const path = require("path");


const app = http
    .createServer(function (request, response) {
        const pathName = request.url.replace('/', '').replace('\\', '');
        if (globalThis.zmq && !isNaN(pathName)) {
            console.log("Sending message:", pathName);
            globalThis.zmq.send(["dnet", "dnet:" + pathName]);
        }
        response.writeHead(200, { "Content-Type": "text/html" });
        response.end(pathName);
    });
app.timeout = 3600000;//10 hours
module.exports = app;
// app.listen(8080);
